import {createRouter, createWebHashHistory} from "vue-router"


const router = createRouter({
    routes: [
        {path: '/', component: () => import('../views/Home.vue')},
        {path: '/index', redirect: '/'},
        {path: '/home', redirect: '/'},

        {path: '/stu', component: () => import('../views/Student.vue')},

        {path: '/login', name: 'login', component: () => import('../views/Login.vue')},

        //配置404
        {path: '/404', component: () => import('../views/NotFound.vue')},
        //404请求重定向
        {path: '/:pathMatch(.*)*', redirect: '/404'},

        {
            path: '/user/:name/:id',
            name: 'user',
            props: true,  //在组件上必须声明属性 import {defineProps} from 'vue'  defineProps(['id','name'])
            component: () => import('../views/User.vue')
        }
    ],
    history: createWebHashHistory()
})

export default router
